/*
 * Camera.h
 *
 *  Created on: 13 mars 2011
 *      Author: seeme
 *      Une caméra très simple pour le moment.
 *      Il faudra gérer les rotation par quaternion plus tard...
 */

#ifndef CAMERA_H_
#define CAMERA_H_

//A simple camera for now.
#include "../../Tools/Geometry/Vect4.h"
#include "../../Tools/Geometry/Quat4f.h"

#include <GL/glew.h>


class Camera {
public:
	Camera(Vect4<float>from, Vect4<float>to, Vect4<float>vertical):m_from(from), m_to(to), m_vertical(vertical){};
	//Camera(Vect4<float>position, Quat4f quat): m_position(position), m_orientation(quat){};
	//Camera(): m_position(0, 0, -40), m_orientation(){};
	Camera(): m_from(), m_to(), m_vertical(){};
	virtual ~Camera(){};

	void update(std::vector<int> coord);
	void update(int eyex, int eyey, int eyez, int targx, int targy, int targz, int vertx, int verty, int vertz);


	void translateX( float offset );
	void translateY( float offset );
	void translateZ( float offset );
	void rotate( float angle, float axisX, float axisY, float axisZ );
	void rotateX( float angle );
	void rotateY( float angle );
	void rotateZ( float angle );
	void setAspectRatio( float value );
	void setPlanes( float near_plane, float far_plane );
	void setFOV( float angle );
	void glPut();
	void glUpdate();

	Vect4<float> m_from;
	Vect4<float> m_to;
	Vect4<float> m_vertical;

	//Quat4f m_orientation;
	Vect4<float> m_position;

	friend std::ostream& operator<<(std::ostream& out, const Camera& c){
		c.print(out);
		return out;
	}

	void print(std::ostream& o) const {
		o << "Eye: " << m_from << " Target: " << m_to;
	}
};

#endif /* CAMERA_H_ */
